home *** CD-ROM | disk | FTP | other *** search
/ Visual Cafe 3 / Visual Cafe 3.ISO / Vcafe / Sample.bin / Section.java < prev    next >
Text File  |  1998-11-01  |  639b  |  42 lines

  1. /**
  2.  * An employee section object. Allows creation, validation, and ordering of employee sections.
  3.  */
  4.  
  5. public class Section
  6. {
  7.     int val;
  8.     final static int MAX_LENGTH = 10;
  9.  
  10.     Section(int a)
  11.     {
  12.         val = a;
  13.             //{{INIT_CONTROLS
  14.         //}}
  15. }
  16.  
  17.     Section(String a)
  18.     throws NumberFormatException
  19.     {
  20.         System.out.println("Parsing section; a='" + a + "' (" + a.length() + " chars)");
  21.         val = Integer.parseInt(a.trim());
  22.     }
  23.  
  24.     int value()
  25.     {
  26.         return val;
  27.     }
  28.  
  29.     public boolean isValid()
  30.     {
  31.         return val > 0;
  32.     }
  33.  
  34.     public boolean isGreaterThan(Section a)
  35.     {
  36.         return val > a.value();
  37.     }
  38.     //{{DECLARE_CONTROLS
  39.     //}}
  40. }
  41.  
  42.